home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / bin / util / medit2gv < prev    next >
Text File  |  1992-08-31  |  1KB  |  59 lines

  1. #! /bin/sh
  2.  
  3.  
  4. if [ "$1" = "" ]; then
  5.     set $HOME/.medit.mat $HOME/.medit.lgt
  6. fi
  7.  
  8. echo "(merge-baseap  appearance {"
  9.  
  10. for f in $@; do
  11.     if [ ! -f "$f" ]; then
  12.     echo "$0: $f: file not found" >&2
  13.     continue
  14.     fi
  15.  
  16.     case "$f" in
  17.     *.mat)
  18.         echo "  material {
  19.     ka 1.0 kd 1.0 ks 1.0"
  20.         while read kw args ; do
  21.         case "$kw" in
  22.             ambient|diffuse|specular|shininess) echo "    $kw $args" ;;
  23.         esac
  24.         done <$f
  25.         echo "  }"
  26.         ;;
  27.     *.lgt)
  28.         echo "  lighting {
  29.     replacelights"
  30.         first=1
  31.         while read kw args; do
  32.         case "$kw" in
  33.             localviewer) echo "    $kw $args" ;;
  34.             ambient)
  35.             if [ "$first" != "" ]; then
  36.                 echo "    $kw $args"
  37.                 first=
  38.             else
  39.                 echo "    light {"
  40.                 if [ "$args" != "0.000000 0.000000 0.000000" ]; then
  41.                 echo "        $kw $args"
  42.                 fi
  43.             fi ;;
  44.             color)
  45.             echo "        $kw $args" ;;
  46.             position)
  47.             echo "        $kw $args"
  48.             echo "    }"
  49.             ;;
  50.         esac
  51.         done <$f 
  52.         echo "  }" ;;
  53.     *)
  54.         echo "$0: $f: expected *.mat or *.lgt suffix." >&2 ;;
  55.     esac
  56. done
  57.  
  58. echo "} )"
  59.